package com.angis.fx.db;

import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;

public class ZCTypeDBHelper extends ObjectDBHelper {
	
	public static final String PK_ZID = "zid";
	public static final String COLUMN_ZCONDITIONTYPE = "zconditiontype";
	public static final String COLUMN_ZWGTYPE = "zwgtype";
	public static final String COLUMN_ZCREATIONTIME = "zcreationtime";
	public static final String TABLE_ZCTYPE = "zctype";

	public ZCTypeDBHelper(Context context) {
		super(context);
	}
	
	public long insertWGType(ContentValues pValues) {
		return insert(TABLE_ZCTYPE, pValues);
	}
	
	public boolean delAll() {
		if(null == writeDB) {
			writeDB = dbHelper.getWritableDatabase();
		}
		return writeDB.delete(TABLE_ZCTYPE, null, null) > 0;
	}
	
	public Cursor getZCTypeByConditionType(String pConditionType) {
		String[] lParams = new String[]{pConditionType};
		if (writeDB == null)
			writeDB = dbHelper.getReadableDatabase();
		return writeDB.query(TABLE_ZCTYPE, new String[]{PK_ZID,
				COLUMN_ZCONDITIONTYPE, COLUMN_ZWGTYPE, COLUMN_ZCREATIONTIME}, COLUMN_ZCONDITIONTYPE + "=?", lParams, null, null, null);
	}

}
